
class Student{
    private String name;
    private String gender;
    private int age;
    private double score;
    private static String classRoom = "306";

    public static String getClassRoom(){
        return classRoom;
    }

}
public class TestStudent {

    public static void main(String[] args) {
        System.out.println(Student.getClassRoom());
    }




/*
    public static void main1(String[] args) {
 // 静态成员变量可以直接通过类名访问
     System.out.println(Student.classRoom);
     Student s1 = new Student("Li leilei", "男", 18, 3.8);
     Student s2 = new Student("Han MeiMei", "女", 19, 4.0);
     Student s3 = new Student("Jim", "男", 18, 2.6);
     // 也可以通过对象访问：但是classRoom是三个对象共享的
     System.out.println(s1.classRoom);
     System.out.println(s2.classRoom);
     System.out.println(s3.classRoom);
    }
*/
}
